package com.x.erp.dao;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.x.erp.thirdparty.ShopMappingQczj;
import com.x.framework.dao.BaseDao;

/**
 * 与汽车之家商户关系映射
 * @author gdf
 *
 */
@Repository
public class ShopMappingQczjDao extends BaseDao {
	
	private final static String selectQczjShopListSql = "SELECT T1.* FROM ERP_SHOP_MAPPING_QCZJ T1 WHERE 1=1 ";
	
	public List<ShopMappingQczj> selectQczjShopList(ShopMappingQczj shopMappingQczj) throws Exception{
		StringBuilder sb = new StringBuilder(selectQczjShopListSql);
		List<Object> params = new ArrayList<Object>();
		if(this.isString(shopMappingQczj.getShopId())){
			sb.append("AND T1.SHOP_ID = ? ");
			params.add(shopMappingQczj.getShopId());
		}
		if(this.isNotNull(shopMappingQczj.getMappingDealerId())){
			sb.append("AND T1.MAPPING_DEALER_ID = ? ");
			params.add(shopMappingQczj.getMappingDealerId());
		}
		if(this.isString(shopMappingQczj.getMappingDealerKey())){
			sb.append("AND T1.MAPPING_DEALER_KEY = ? ");
			params.add(shopMappingQczj.getMappingDealerKey());
		}
		if(this.isNotNull(shopMappingQczj.getMappingSalerId())){
			sb.append("AND T1.MAPPING_SALER_ID = ? ");
			params.add(shopMappingQczj.getMappingSalerId());
		}
		return this.queryForList(sb.toString(), ShopMappingQczj.class, params);
	}

}
